package cn.tmpan.project.common;

/**
 * @author tieMinPan
 * @Desc: Description
 * @date 2019-10-15 12:11
 */
public class Common {

    /**
     * 分隔符
     */
    public static final String SPLIT_TAG = ">>";

    /**
     * 用户头部认证头信息
     */
    public static final String AUTH_HEADER_ADMIN = "Authorization-Admin";

    /**
     * 管理员认证头部信息
     */
    public static final String AUTH_HEADER_USER = "Authorization-User";


    public enum GENDER {
        UNKNOWN(0, "未知"),
        MAN(1, "先生"),
        WOMAN(2, "女士");
        private Byte value;
        private String name;

        GENDER(int value, String name) {
            this.value = (byte) value;
            this.name = name;
        }

        public int getValue() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }

        public static GENDER codeOf(int value) {
            for (GENDER s : values()) {
                if (s.value == value) {
                    return s;
                }
            }
            throw new RuntimeException("没有对应得枚举类型");
        }
    }

    public enum DEL_TAG {
        UNKNOWN(2, "未知"),
        YES(1, "已删除"),
        NO(0, "未删除");
        private Integer value;
        private String name;

        DEL_TAG(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public Integer getValue() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }

        public static DEL_TAG codeOf(int value) {
            for (DEL_TAG s : values()) {
                if (s.value == value) {
                    return s;
                }
            }
            throw new RuntimeException("没有对应得枚举类型");
        }
    }

    public enum STATUS {
        UNKNOWN(2, "未知"),
        ENABLED(0, "启用"),
        DISABLED(1, "禁用");
        private Integer value;
        private String name;

        STATUS(int value, String name) {
            this.value = value;
            this.name = name;
        }

        public Integer getValue() {
            return this.value;
        }


        public String getName() {
            return this.name;
        }


        public static STATUS codeOf(int value) {
            for (STATUS s : values()) {
                if (s.value == value) {
                    return s;
                }
            }
            throw new RuntimeException("没有对应得枚举类型");
        }
    }


}
